package com.zf.springdoc.controller;

import com.zf.springdoc.entity.UserInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author Zhou Feng
 */
@Tag(name = "用户信息")
@RestController
@RequestMapping("/userInfo")
public class UserInfoController {


    @Operation(summary = "随机返回一个用户信息")
    @GetMapping("/randOne")
    public UserInfo randOne() {
        Random random = new Random();
        int num = random.nextInt(20, 30);
        UserInfo userInfo = new UserInfo();
        userInfo.setName("李四" + num);
        userInfo.setAge(num);
        return userInfo;
    }

}
